<extend name="base"/>
<block name="body">

<div id="wechat_menu" class="r_con_wrap">
    <script type='text/javascript' src='__PUBLIC__/Member/js/plugin/dragsort/dragsort-0.5.1.min.js'></script>
    <script language="javascript">$(document).ready(wechat_obj.menu_init);</script>
    <div class="m_menu">
        <div class="tips_info">
            1. 您的公众平台帐号类型必须升级为<span>服务号</span>。<br />
            2. 升级为服务号后，必须在微信公众平台申请接口使用的<span>AppId</span>和<span>AppSecret</span>，然后在【<a href="{:U('wechat/auth')}">微信授权配置</a>】中设置。<br />
            3. 最多创建<span>3</span>个一级菜单，每个一级菜单下最多可以创建<span>5</span>个二级菜单，菜单最多支持两层。<br />
            4. 拖动树形菜单可以对菜单重排序，但最终只有“<span>发布菜单</span>”后才会生效，公众平台限制了每天的发布次数，请勿频繁操作。<br />
            5. 微信公众平台规定，<span>菜单发布24小时后生效</span>。您也可先取消关注，再重新关注即可马上看到菜单。<br />
            6. 点击“<span>删除菜单</span>”操作只删除微信公众平台上的菜单，并不是删除本系统已经设置好的菜单。
        </div>
        <div class="form">
            <div class="m_lefter">
                <dl>
                <foreach name="menu" item="v">
                    <dd MId="{$v['id']}">
                            <div class="list ">
                                <a href="{:U('classify',array('id'=>$v['id']))}" title="修改"><img src="__PUBLIC__/Member/images/ico/mod.gif" align="absmiddle" /></a>
                                <a href="{:U('delClassify',array('id'=>$v['id']))}" title="删除" onClick="if(!confirm('删除后不可恢复，继续吗？')){return false};"><img src="__PUBLIC__/Member/images/ico/del.gif" align="absmiddle" /></a>
                                {$v['title']}                       </div>
                              <ul>
                              <foreach name="v._child" item="vv">
                                    <li MId="{$vv['id']}">
                                         <div class="title"><img src="__PUBLIC__/Member/images/ico/jt.gif" />{$vv['title']} </div>
                                            <div class="opt">
                                                <a href="{:U('classify',array('id'=>$vv['id']))}"><img src="__PUBLIC__/Member/images/ico/mod.gif" /></a>
                                                <a href="{:U('delClassify',array('id'=>$vv['id']))}" onClick="if(!confirm('删除后不可恢复，继续吗？')){return false};"><img src="__PUBLIC__/Member/images/ico/del.gif" /></a>
                                            </div>
                                    </li>
                              </foreach>
                              </ul>
                         <div class="blank9"></div>
                    </dd>
                </foreach>
                </dl>
                <div class="publish">
                    <input type="button" class="btn_green" url="{:U('Wechat/publishClassify')}" name="publish_btn" value="发布菜单">
                    <input type="button" class="btn_gray" url="{:U('Wechat/delPublishedClassify')}" name="del_btn" value="删除菜单">
                </div>
            </div>
            <div class="m_righter">
                <form id="wechat_menu_form" class="" action="" method="post">
                    <h1><eq name="update" value="1">更新菜单<else/>添加菜单</eq></h1>
                    <div class="opt_item">
                        <label>菜单名称：</label>
                        <span class="input"><input type="text" name="title" value="{$menuInfo.title}" class="form_input" size="15" maxlength="15" notnull /> <font class="fc_red">*</font></span>
                        <div class="clear"></div>
                    </div>
                                            <div class="opt_item">
                            <label>添加到：</label>
                            <span class="input">
	                            <select name="pid">
	                                <option value="0">一级菜单</option>
	                                 <foreach name="parentMenu" item="v">
	                                   <option value="{$v.id}" <eq name="menuInfo.pid" value="$v.id">selected="selected"</eq>>{$v.title}</option>
	                                 </foreach>
	                            </select>
	                        </span>
                            <div class="clear"></div>
                        </div>
                                        <div class="opt_item">
                        <label>消息类型：</label>
                        <span class="input"><select name="MsgType">
                            <option value="0" <eq name="menuInfo['config']['msgtype']" value="text">selected</eq>>文字消息</option>
                            <option value="1" <if condition="($menuInfo['config']['msgtype'] eq 'text' ) OR ($menuInfo['config']['msgtype'] eq 'url') "><else/>selected</if>>图文消息</option>
                            <option value="2" <eq name="menuInfo['config']['msgtype']" value="url">selected</eq>>连接网址</option>
                        </select></span>
                        <div class="clear"></div>
                    </div>
                    <div class="opt_item" id="text_msg_row">
                        <label>文字内容：</label>
                        <span class="input"><textarea name="text">{$menuInfo.config.textmsg.text}</textarea></span>
                        <div class="clear"></div>
                    </div>
                    <div class="opt_item" id="img_msg_row">
                        <label>图文内容：</label>
                        <span class="input">
                            <select name='MaterialId'>
                                <option value=''>--请选择--</option>
                                <!-- <optgroup label='---------------系统业务模块---------------'></optgroup>
                                <foreach name="moudles_news.modules" item="v">
	                                <option value='{$v.name}' <eq name="menuInfo.config.msgtype" value="$v.name">selected</eq> >{$v.title}</option>
                                </foreach> -->
                                <optgroup label='---------------图文消息---------------'></optgroup>
                                <foreach name="moudles_news.newsmsgs" item="v">
                                    <option value='{$v.id}' <eq name="menuInfo.config.msgid" value="$v.id">selected="selected"</eq>>【<eq name="v.msgtype" value="onenews">单图文<else/>多图文</eq>】{$v.title}</option>
                                </foreach>
                            </select><a href="{:U('Material/index')}">素材管理</a></span>
                        <div class="clear"></div>
                    </div>
                    <div class="opt_item" id="url_msg_row">
                        <label>链接网址：</label>
                        <span class="input"><input type="text" name="url" value="{$menuInfo.config.url}" class="form_input" size="35" maxlength="200" /></span>
                        <div class="clear"></div>
                    </div>
                    <div class="opt_item">
                        <label></label>
                        <span class="input"><input type="submit" class="btn_green btn_w_120" name="submit_button" value="添加菜单" /></span>
                        <div class="clear"></div>
                    </div>
                    <input type="hidden" name="id" value="{$menuInfo.id}">
                    <input type="hidden" name="sort" value="{$menuInfo.sort}">
                </form>
            </div>
            <div class="clear"></div>
        </div>
    </div>
</div>  

</block>